package com.designpattern.behavior.iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Administration
 * @date 2021/10/27 - 11:08 - 星期三
 * @project 行为型模式中的迭代器模式  具体聚合角色
 * @package com.designpattern.behavior.iterator
 * @by 晨
 */
public class StudentAggregateImpl implements StudentAggregate{

    private List<Student> list = new ArrayList<>();

    @Override
    public void addStudent(Student student) {
        list.add(student);
    }

    @Override
    public void removeStudent(Student student) {
        list.remove(student);
    }

    @Override
    public StudentIterator getStudent() {
        return new StudentIteratorImpl(list);
    }
}
